package 剑指offer;

import java.util.ArrayList;



interface IShape {
    public abstract void draw1();

}
class Cycle2 implements IShape {

    @Override
    public void draw1() {
        System.out.println("⚪");
    }
}


class Person {
    public String name;

    public static void func() {
        System.out.println(555);
    }

}

class Stu extends Person{
    int age;
    public Stu(String name) {
        System.out.println(name);

    }


    public static void func() {
        System.out.println(1111);
        //子类的静态方法和父类的静态方法相同(内容不同)，最终调用谁，取决于当前引用类型
        //static修饰的方法，是类方法，类创建的时候就写到内存中了，不能被修改，不存在重写
    }


}

class Shape {
    public void draw() { }
}

class Rect extends Shape {
    public void draw() {
        System.out.println("⬛");
    }
}

class Cycle extends Shape {
    public void draw() {
        System.out.println("⚫");
    }
}
public class test {
    public static void drawShape(Shape shape) {
        shape.draw();
        //同一个引用，调用同一个方法，能够表现出不同形态，就是动态绑定，就是多态
    }

    public static void main(String[] args) {
        Stu stu = new Stu("ss");
        stu.func();
    }

    public static void main4(String[] args) {
        Shape shape1=new Rect();//向上转型
        Cycle shape2=new Cycle();
        drawShape(shape1);
        drawShape(shape2);
    }
    
    public static void main3(String[] args) {
//        int a=2;
//        Person p=new Person();
//        System.out.println(p);
//        Person p1=null;
//        System.out.println(p1);

        ArrayList<Integer> list1=new ArrayList<>();
        list1.add(1);
        list1.add(2);
        list1.add(3);

        ArrayList<Integer> list2=new ArrayList<>(list1);
        System.out.println(list2);




    }

    public static void main1(String[] args) {
        double a= 1.1;
        String names[] =new String[5];
        for (int i = 0; i <args.length ; i++) {
            names[i]=args[i];
        }
        System.out.println(names[2]);

        int[] arr={1,2,3};
        int[] copy=new int[arr.length];
        System.arraycopy(arr,0,copy,0,arr.length);
    }

    static {
        System.out.println("静态代码块！！！");
    }

    {
        System.out.println("实例代码块 或叫做 构造代码块");
    }


}
